//
//  BQBaseDao.m
//  honeycomb
//
//  Created by billionsfinance-resory on 16/2/26.
//  Copyright © 2016年 www.bqjr.cn. All rights reserved.
//

#import "BQBaseDao.h"

@implementation BQBaseDao
+ (id)shareObject
{
    static BQBaseDao *baseDao = nil;
    static dispatch_once_t oncetoken;
    dispatch_once(&oncetoken, ^{
        baseDao = [[BQBaseDao alloc] init];
    });
    return baseDao;
}

// 发起网络请求
- (void)sendRequestToServiceWithRequestType:(netWorkRequestType)netWorkRequestType
                                 andBaseUrl:(NSString *)baseUrl
                               andParameter:(NSDictionary *)parameter
           andServiceReceiveResponseSuccess:(serverResponseSuccess)success
               ServiceReceiveResponseFailed:(serverResponseFailed)failed
{
    switch (netWorkRequestType) {
            // GET方式发网络请求
        case netWorkRequestGet:
        {
            [BQBaseRequest getRequestWithBaseUrl:baseUrl
                                  andParameter:parameter
                            andSuccessCallBack:^(id response) {
                                success(response);
                            } andFailedCallBack:^(id response) {
                                failed(response);
                            }];
        }
            break;
            // POST方式发起网络请求
        case netWorkRequestPost:
        {
            [BQBaseRequest postRequestWithBaseUrl:baseUrl
                                   andParameter:parameter
                             andSuccessCallBack:^(id response) {
                                 success(response);
                             } andFailedCallBack:^(id response) {
                                 failed(response);
                             }];
        }
            break;
        default:
            break;
    }
}


- (void)sendRequestToServiceWithRequestType:(netWorkRequestType)netWorkRequestType
                                 andBaseUrl:(NSString *)baseUrl
                               andParameter:(NSDictionary *)parameter
                              andImageArr:(NSArray *)imageDatas
           andServiceReceiveResponseSuccess:(serverResponseSuccess)success
               ServiceReceiveResponseFailed:(serverResponseFailed)failed
{
    [BQBaseRequest postImageDataWithBaseUrl:baseUrl
                             andParameter:parameter
                         andImageArr:imageDatas
                               andSuccess:^(id response)
     {
         
         success(response);
         
     } andFailed:^(id response) {
         
         failed(response);
         
     }];
}

- (NSString *)setBaseUrlWithBranchUrl:(NSString *)url
{
    return nil;
}

- (NSDictionary *)encryptDataWithParameter:(NSDictionary *)parameter
{
    return nil;
}


@end
